package com.okbihuo.perm.modules.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.okbihuo.perm.core.mp.base.MyServiceImpl;
import com.okbihuo.perm.core.tool.utils.StringUtil;
import com.okbihuo.perm.modules.common.domain.RwbSyncLog;
import com.okbihuo.perm.modules.common.mapper.RwbSyncLogMapper;
import com.okbihuo.perm.modules.common.service.RwbSyncLogService;
import org.springframework.stereotype.Service;

/**
 * 同步记录接口实现层
 * @author Administrator
 */
@Service
public class RwbSyncLogServiceImpl extends MyServiceImpl<RwbSyncLogMapper, RwbSyncLog> implements RwbSyncLogService {

    @Override
    public RwbSyncLog getByNewLogAndType(Long loginUserId, String type){
        QueryWrapper<RwbSyncLog> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtil.humpToUnderline("loginUserId"),loginUserId);
        wrapper.eq("type",type);
        wrapper.orderByDesc(StringUtil.humpToUnderline("syncEndAt"));
        return getOne(wrapper,false);
    }
}
